﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EmoneyWeiXinCommon;

namespace EmoneyWeiXinDAL
{
    public class GroupUserDAL
    {
        public void dianzanDal(string fn, string newsreportid, string type)
        {
            string sql = "";
            sql = "insert into clickzan(fromUserName,newsReportID,UPDATEtime,isvalid) values('" + fn + "','" + newsreportid + "',getdate(),'" + type + "')";
            SQLHelper.ExecuteNonQuery(Config.EmoneyWeiXin, System.Data.CommandType.Text, sql, null);
        }

        public int UpdateStockDoctorlog(string sid, string isstock, int type)
        {
            if (!string.IsNullOrEmpty(sid) && !string.IsNullOrEmpty(isstock) && (type == 1 || type == 2))
            {
                if (isstock == "1")
                {
                    isstock = "0";
                }
                else
                {
                    isstock = "1";
                }
                string sql = "";
                if (type == 1)
                {
                    sql = "update StockDoctorlog set isStock='" + isstock + "' where id='" + sid + "'";
                }
                else
                {
                    sql = "update StockDoctorlog set isreply='" + isstock + "' where id='" + sid + "'";
                }
                return SQLHelper.ExecuteNonQuery(Config.EmoneyWeiXin, System.Data.CommandType.Text, sql, null);
            }
            return 0;
        }

        public void C_ReplyManagerDal(string StockDoctorlogid, string weixinid, string newsreportid, string nickName, string hfCOntent, DateTime updatetime, string remark)
        {
            string sql = "insert into C_ReplyManager(StockDoctorlogid,weixinid,newsreportid,nickName,hfCOntent,updatetime,remark) values";
            sql += " ('" + StockDoctorlogid + "','" + weixinid + "','" + newsreportid + "','" + nickName + "','" + hfCOntent + "','" + updatetime + "','" + remark + "')";
            SQLHelper.ExecuteNonQuery(Config.EmoneyWeiXin, System.Data.CommandType.Text, sql, null);
        }
    }
}
